package cn.mumzone.pos.ui.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

import cn.mumzone.pos.ui.fragment.FRA_DailyNew;
import cn.mumzone.pos.ui.fragment.FRA_Exception;
import cn.mumzone.pos.ui.fragment.FRA_SalesVolume;

/**
 * author:        yupeng
 * created on:    2019/7/10 18:13
 * description:   业务报表Pager适配器
 */
public class ADA_ReportFormFragmentPager extends FragmentPagerAdapter {

    private final String[] names = {"营业日报", "商品销量", "异常情况"};
    private List<Fragment> fragmentList;

    public ADA_ReportFormFragmentPager(FragmentManager fm) {
        super(fm);
        initFragmentList();
    }

    private void initFragmentList() {
        fragmentList = new ArrayList<>();
        fragmentList.add(FRA_DailyNew.newInstance());
        fragmentList.add(FRA_SalesVolume.newInstance());
        fragmentList.add(FRA_Exception.newInstance());
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return names[position];
    }
}
